package com.study.ssm.annotation02.aop;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;

/**
 * @author zhoujunlin
 * @date 2023年07月27日 9:41
 * @desc
 */
@Aspect
@Component
public class MyAspect {

    @Pointcut("execution(* com.study.ssm.annotation02.aop..*.*(..))")
    public void pointcut() {
    }

    @Around("pointcut()")
    public Object around(ProceedingJoinPoint pjp) {
        System.out.println("MyAspect.around before======>");
        Object ret = null;
        try {
            ret = pjp.proceed();
        } catch (Throwable e) {
            System.out.println("MyAspect.around exception======>");
            e.printStackTrace();
        }
        System.out.println("MyAspect.around after======>");
        return ret;
    }

}
